#include <string>
#include <iostream>
#include "../Headers/types.h"
#include "nameserver.h"

int main ()
{
  TOB::Nameserver::IP ip;
  std::string sip = "127.0.0.1";
  if(TOB::Nameserver::convertString(sip, ip) == Code::Okay) {
    std::cout << "IP is " << ip << std::endl;
  } else {
    std::cout << "Can't convert ip" << std::endl;
  }
  

	TOB::Nameserver ns("localhost");
	Code::Type result = ns.requestAddress(Server::Authentication, ip);
	
	if(result == Code::Okay) {
		std::string addr;
		ns.convertIP(ip, addr);
		std::cout << "Server is " << addr << std::endl;
	} else {
		std::cout << "Error occured!" << std::endl;
	}
	return 0;
}
